//
//  ViewController.m
//  12-7bookshelf
//
//  Created by blue on 15-12-7.
//  Copyright (c) 2015年 hyd. All rights reserved.
//

#import "ViewController.h"
#import "BookTableViewCell.h"
@interface ViewController ()
{

    NSArray * imags;
}
@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    self.title = @"我的书架";
    self.tableView.showsHorizontalScrollIndicator = NO;
    NSBundle * bundle = [NSBundle mainBundle];
    imags = [bundle URLsForResourcesWithExtension:@"jped" subdirectory:nil];
    
    self.tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    [ self.view addSubview:self.tableView];



}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;

}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

{
    return 139;

}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSMutableArray * arr =  [NSMutableArray array];
    for (NSURL * url in imags) {
        [arr addObject:[UIImage imageNamed:url.lastPathComponent]];
    }
    
    
    
    static NSString * reuse =@"Reuse";
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:reuse];
    
    if (!cell) {
        
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuse];
    }
    cell.backgroundView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"BookShelfCell.png"]];
    
    cell.selectionStyle = UITableViewCellAccessoryNone;
    return cell;

}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
